<template>
  <div>
    组件2
    <div>
      <div>
        <input type="text" />
      </div>
      <el-select v-model="value" placeholder="Element组件选择">
        <el-option v-for="(item, i) in list" :key="i" :value="item">
        </el-option>
      </el-select>
      <transition mode="out-in">
        <component :is="componentId"></component>
      </transition>
    </div>
  </div>
</template>

<script>
import Es6练习 from "./components/Es6.vue";
import one from "./components/one.vue";
export default {
  name: "sontwo",
  components: {
    Es6练习,
    one,
  },
  data() {
    return {
      componentId: "Es6练习",
      list: ["Es6练习", "one"],
      value: "",
    };
  },
  watch: {
    value() {
      this.componentId = this.value;
    },
  },
  methods: {
    handleCommand(data) {
      console.log(data);
    },
  },
};
</script>
